package com.rich.domain;

import java.util.List;

public class PageBean<T> {
	private List<T> data;//当前页数据：查询limit (pageNumber - 1)*pageSize，pageSize
	private int pageNumber;//当前页
	private int totalRecore;//总条数	：查询count(*)
	private int pageSize;   //每页数量:固定值
	private int totalPage;  //总页数：计算出来：Math.ceil(pageRecord*1.0)/pageSize
	private int startIndex;//limit (pageNUmber-1)*pageSize
	
	public List<T> getData() {
		return data;
	}
	public void setData(List<T> data) {
		this.data = data;
	}
	public int getPageNumber() {
		return pageNumber;
	}
	public void setPageNumber(int pageNumber) {
		this.pageNumber = pageNumber;
	}
	public int getTotalRecore() {
		return totalRecore;
	}
	public void setTotalRecore(int totalRecore) {
		this.totalRecore = totalRecore;
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}
	public int getTotalPage() {
		return (int) Math.ceil(this.totalRecore*1.0/pageSize);
	}
	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}
	
	public PageBean() {
		// TODO Auto-generated constructor stub
	}
	public PageBean(int pageNumber,int pageSize){
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
	}
	public int getStartIndex() {
		return (this.pageNumber-1)*this.pageSize;
	}
	public void setStartIndex(int startIndex) {
		this.startIndex = startIndex;
	}
	@Override
	public String toString() {
		return "PageBean [data=" + data + ", pageNumber=" + pageNumber + ", totalRecore=" + totalRecore + ", pageSize="
				+ pageSize + ", totalPage=" + totalPage + ", startIndex=" + startIndex + "]";
	}
	
	
}
